//所有资源、变量和配置信息都在这里！
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import axios from 'axios';
@Injectable()
export class ConfigService {
    //环境配置  false = 测试环境  true = 生产环境
    environment = true; 

    prevUrl1 = ''; //yxb服务器url前缀
    prevUrl2 = '';//统一验证服url前缀
    prevUrl3 = '';//PHP服务器前缀
    accessTokenUrl = '';//获取accessTokenURL
    phoneUrl = '';//获取号码的URL
    sendSmsUrl = '';//获取短信验证的URL
    checkSmsUrl = '';//验证短信验证的URL
    phoneNumStr = '';
    appId = ''; //统一验证的应用ID 
    stampProcessUrl = '';
    expandParams = '';
    redirectUrl = '';
    Url11 = '';
    loginUrl = '';
    userUrl = '';
    yxbUrl = '';
	constructor(){
        //生产环境
        if(this.environment){
            this.prevUrl1 = "http://yxb.mmarket.com/mssp_pps/";
            this.prevUrl2 = "http://www.cmpassport.com/openapi/";  
            this.prevUrl3 = "http://yxbsve.mmarket.com/" 
            this.appId = '000011';
        }
        //测试环境 
        else {
            this.prevUrl1 = "http://120.197.230.65:40081/mssp_pps/";
            this.prevUrl2 = "http://121.15.167.251:30030/umcopenapi/";
            this.prevUrl3 = "http://120.197.230.65:40585/"
            this.appId = '100000';
            this.phoneNumStr = encodeURI('phoneNum=13921322711');
            
        }
        this.accessTokenUrl = this.prevUrl1 + 'cmpassport/znGetAccessToken.do';
        this.phoneUrl = this.prevUrl1 + 'cmpassport/getPhone.do';
        this.sendSmsUrl = this.prevUrl1 + 'cmpassport/sendSmsCode.do';
        this.checkSmsUrl = this.prevUrl1 + 'cmpassport/checkSmsCode.do';
        this.loginUrl =this.prevUrl3+"index.php?c=wechat&a=userform";
        this.stampProcessUrl = this.prevUrl3 + "index.php?c=wechat&a=states";
        this.Url11 = this.prevUrl3 + "index.php?c=wechat&a=stus";
        this.userUrl = this.prevUrl3 + "index.php?c=wechat&a=userform";
        this.yxbUrl = this.prevUrl3 + "index.php?c=wechat&a=index#/";
        
    }
    //service的接口如下：
    getEnvironment(){
        return this.environment;
    }
    getAccessTokenUrl(){
        return this.accessTokenUrl;
    }
    getPhoneUrl(){
        return this.phoneUrl;
    }
    getSendSmsUrl(){
        return this.sendSmsUrl;
    }
    getCheckSmsUrl(){
        return this.checkSmsUrl;
    }
    getPrevUrl1(){
        return this.prevUrl1;
    }
    getPrevUrl2(){
        return this.prevUrl2;
    }
    getAppId(){
        return this.appId;
    }
    getExpandParams(){
        return this.expandParams;
    }
    getRedirectUrl(){
        return this.redirectUrl;
    }
    getPhoneNumStr(){
        return this.phoneNumStr;
    }
    getLoginUrl(){
        return this.loginUrl;
    }
    get11Url(){
        return this.Url11;
    }
    getUserUrl(){
        return this.userUrl;
    }
    getYxbUrl(){
        return this.yxbUrl;
    }

}